Skip to content

Conversation

@dermitzos
Copy link
Collaborator

This pull request introduces a new built-in function, resetVisits, to the Arcscript interpreter and updates the testing framework to validate event emissions. The main changes include implementing the resetVisits function, updating the interpreter and state management to support event callbacks, and expanding test coverage for the new functionality. There are also improvements to the ESLint configuration and dependencies.

Arcscript Interpreter Enhancements:

  • Added a new built-in function resetVisits to ArcscriptFunctions, which resets all visit counters and emits a resetVisits event. (JavaScript/src/ArcscriptFunctions.js [1] JavaScript/src/ArcscriptState.js [2] grammar/ArcscriptLexer.g4 [3]
  • Updated ArcscriptState, ArcscriptVisitor, and Interpreter classes to accept an emit/eventHandler callback, enabling event-driven functionality such as emitting events when visits are reset. (JavaScript/src/ArcscriptState.js [1] [2]; JavaScript/src/ArcscriptVisitor.js [3]; JavaScript/src/antlr4.interpreter.js [4] [5]

Testing Improvements:

  • Enhanced the test suite to allow validation of emitted events by accepting an events field in test cases and asserting that the event handler is called with the correct arguments. (JavaScript/__tests__/antlr4.interpreter.spec.js [1] [2]
  • Added a new test case for resetVisits to valid.json to ensure correct behavior and event emission. (JavaScript/__tests__/valid.json JavaScript/tests/valid.jsonR390-R405)

Tooling and Configuration:

  • Added @jest/globals as a development dependency for improved Jest support. (JavaScript/package.json JavaScript/package.jsonR43)
  • Updated ESLint configuration to enforce import/no-extraneous-dependencies for test files, improving code quality and dependency management. (JavaScript/package.json JavaScript/package.jsonL103-R114)

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 23, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@arcweave/arcscript@7

commit: f31d045

@dermitzos dermitzos force-pushed the feat/resetVisits-function branch from 5e60081 to 43d610a Compare January 24, 2026 13:13
@dermitzos dermitzos force-pushed the feat/resetVisits-function branch from 2127b1f to f31d045 Compare January 26, 2026 18:34
@dermitzos dermitzos merged commit 0e247fa into main Jan 27, 2026
6 checks passed
@dermitzos dermitzos deleted the feat/resetVisits-function branch January 27, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants